import { createSlice } from "@reduxjs/toolkit";

const userStore = createSlice({
    name: "user",
    initialState: {
        userInfo: ["傻狗"]
    },
    reducers: {
        userInfoSync(state, action) {
            switch (action.type) {
                case "set":
                    state.userInfo = action.payload;
                case "get":
                    return  state.userInfo;
                default:
                     return state;
            }
        }
    }

});


const {userInfoSync}=userStore.actions;

export {userInfoSync};

export default userStore.reducer;